<template>
  <n-message-provider>
    <router-view />
  </n-message-provider>
</template>

<script setup lang="ts">
import { NMessageProvider } from "naive-ui";
import { useUserStore } from "@/store";
import wsSocket from "@/plugins/ws-socket.ts";
import { routerBeforeEach } from "@/router";

// 加载全局路由守卫
routerBeforeEach();
// wsSocket连接
const token = useUserStore()?.token;
if (token) {
  wsSocket.connect(token);
}
</script>

<style scoped></style>
